/*
 * SwingDelegate.h  0.4.0 / Nov 17, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
#ifndef SWINGDELEGATE_H
#define SWINGDELEGATE_H

#include "Cute4jSwing.h"

// SwingDelegate Class. --------------------------------------------------------

/*!
 * \brief Swing Delegate.
 *
 * \author Slobodan Vrkacevic
 * \version 0.4.0
 */
class CUTE4J_EXPORT SwingDelegate
{
public: // native calls
  static jint getVersion(JNIEnv *env, jclass cls, jclass loggerClass);
  static void initialize(JNIEnv *env, jclass cls, jobjectArray args,
                         jclass colorClass, jclass dimensionClass,
                         jclass rectangleClass, jclass fontClass,
                         jclass imageClass, jclass iconSetClass,
                         jclass runnableClass, jclass iteClass,
                         jclass systemColorPaletteClass,
                         jclass systemFontSetClass);
  static void dispose(JNIEnv *env, jclass cls);
  static jint exec(JNIEnv *env, jclass cls);
  static void exit(JNIEnv *env, jclass cls, jint returnCode);
  static void flush(JNIEnv *env, jclass cls);
  static void disableNativeLogging(JNIEnv *env, jclass cls);
  static jboolean setTranslation(JNIEnv *env, jclass cls, jstring fileName);
  static void removeTranslation(JNIEnv *env, jclass cls);
  static jstring translate(JNIEnv *env, jclass cls, jstring context,
                           jstring sourceText);
  static jobjectArray availableStyles(JNIEnv *env, jclass cls,
                                      jclass systemStyleClass);
  static jboolean setStyle(JNIEnv *env, jclass cls, jstring name);
  static void setStyleSheet(JNIEnv *env, jclass cls, jstring styleSheetText);
  static void setOverrideCursor(JNIEnv *env, jclass cls, jint type);
  static void changeOverrideCursor(JNIEnv *env, jclass cls, jint type);
  static void restoreOverrideCursor(JNIEnv *env, jclass cls);
  static jobjectArray availableThemes(JNIEnv *env, jclass cls,
                                      jclass systemThemeClass);
  static void setTheme(JNIEnv *env, jclass cls, jobject colorPalette,
                       jobject fontSet);
  static void setUseSystemTheme(JNIEnv *env, jclass cls,
                                jboolean useSystemTheme);
  static void aboutCute4j(JNIEnv *env, jclass cls, jstring version,
                          jstring date);
  static void aboutQt(JNIEnv *env, jclass cls);
  static void setCustomProperty(JNIEnv *env, jclass cls, jstring name,
                                jstring value);
  static ushort getSwingKeyChar(QKeyEvent *e);
  static jint toSwingModifiers(Qt::KeyboardModifiers modifiers);
  static Qt::KeyboardModifiers toKeyboardModifiers(int keyCode);
  static jint toSwingButton(Qt::MouseButton button);
  static jint toSwingKeyCode(int keyCode);
  static Qt::Alignment toHorizontalAlignment(jint alignment);
  static Qt::Alignment toVerticalAlignment(jint alignment);
public:
  inline static bool isDisposed();
private:
  static bool sm_disposed;
private:
  static const Qt::Alignment HORIZONTAL_ALIGNMENT[];
  static const Qt::Alignment VERTICAL_ALIGNMENT[];
};

// SwingDelegate :: Public Static Inline Member Function. ----------------------

/*!
 * \brief Returns \c true if SwingDelegate is disposed.
 *
 * \return \c true if SwingDelegate is disposed
 */
inline bool SwingDelegate::isDisposed()
{
  return sm_disposed;
}

#endif // SWINGDELEGATE_H
